// windows system cmd-dos HideWindow

//go:build windows
// +build windows

package gouciparser

import (
	"os/exec"
	"syscall"
)

func cmdSysProcAttr(cmd *exec.Cmd) {
	cmd.SysProcAttr = &syscall.SysProcAttr{HideWindow: true, CreationFlags: 0x08000000}
}

func fileChmod(name string) error {
	// windows系统先修改文件所有权，使得任何用户都可以修改文件
	// cmdstr := fmt.Sprintf("icacls %s /grant \"everyone\":(OI)(CI)M", name)
	// cmdstr := fmt.Sprintf("icacls %s /grant \"everyone\":(OI)(CI)M", name)
	cmd := exec.Command("cmd", "/C", "icacls", name, "/grant", "Everyone:(OI)(CI)M", "/T")
	cmdSysProcAttr(cmd)
	return cmd.Run()
}
